const mongoose = require('mongoose')

const Schema = mongoose.Schema
const Types = Schema.Types

const RegCode = new Schema({
  id: Types.ObjectId,
  fromUser: {
    type: Types.String,
    required: true,
    index: 1
  },
  fromUsername: Types.String,
  expireTime: {
    type: Types.Date,
    required: true,
    index: 1
  },
  useTime: {
    type: Types.Date,
    default: 0
  }
})

module.exports = mongoose.model('RegCode', RegCode)
